﻿@using Markdig;
@using System.Net.Http;
@using Microsoft.AspNetCore.Blazor;

@inject HttpClient Http

@if (Content == null)
{
    <span>Loading...</span>
}
else
{
    @((MarkupString)BuildHtmlFromMarkdown(Content))
}

@functions {

[Parameter]
string Content { get; set; }

private string BuildHtmlFromMarkdown(string value) => Markdig.Markdown.ToHtml(
    markdown: value,
    pipeline: new MarkdownPipelineBuilder().UseAdvancedExtensions().Build()
);

}